﻿namespace Hiver.Cache.Interfaces
{
    /// <summary>
    /// 缓存接口
    /// </summary>
    public interface ICache
    {
        /// <summary>
        /// 设置缓存
        /// </summary>
        /// <param name="name"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        object Set(string name, object value);

        /// <summary>
        /// 读取缓存
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        object Get(string name);

        /// <summary>
        /// 判断是否有缓存项
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        bool Has(string name);

        /// <summary>
        /// 移除缓存
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        object Remove(string name);

        /// <summary>
        /// 清空缓存
        /// </summary>
        /// <returns></returns>
        long Clear();

        /// <summary>
        /// 刷新缓存
        /// </summary>
        void Flush();
    }
}